//
//  UILabel+YHCount.h
//  YHKit
//
//  Created by 林宁宁 on 2021/5/14.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

/// https://github.com/dataxpress/UICountingLabel

typedef NS_ENUM(NSInteger, YHAnimationCountingMethod) {
    YHAnimationCountingMethod_EaseInOut,
    YHAnimationCountingMethod_EaseIn,
    YHAnimationCountingMethod_EaseOut,
    YHAnimationCountingMethod_Linear,
    YHAnimationCountingMethod_EaseInBounce,
    YHAnimationCountingMethod_EaseOutBounce
};



@interface YHLabelCountingConfig : NSObject


@property (nonatomic, copy) NSString *format;
@property (nonatomic, assign) YHAnimationCountingMethod method;

// 字符串格式
@property (nonatomic, copy) NSString * _Nullable (^_Nullable formatBlock)(CGFloat value) ;
@property (nonatomic, copy) NSAttributedString * _Nullable (^_Nullable attributedFormatBlock)(CGFloat value);
@property (nonatomic, copy) void(^_Nullable completionBlock)(void);

/// 获取初始值
@property (nonatomic, copy) CGFloat (^_Nullable startValueBock)(void);

- (void)clean;

@end

/// 数字变化动画
@interface UILabel (YHCount)

@property (retain, nonatomic) YHLabelCountingConfig * yh_countingConfig;

- (void)yh_countingTo:(CGFloat)endValue;
- (void)yh_countingWithoutAnimationTo:(CGFloat)endValue;

@end

NS_ASSUME_NONNULL_END
